/*
 * JPanel.java
 *
 * Created on April 14, 2004, 3:41 PM
 */

package edu.psu.geovista.app.dataloader.v1.gui;

import edu.psu.geovista.app.dataloader.v1.DataLoaders;
import edu.psu.geovista.app.dataloader.v1.actions.WizardData;

import javax.swing.*;

/**
 *
 * @Original Author  jinchen
 */
public class AskProjectTypePane extends BasicPane {

    int projectType;

    /** Creates new form JPanel */
    //public AskProjectTypePane() {
        /*initComponents();
        this.buttonGroup1.add(this.newProj );
        this.buttonGroup1.add(this.currentProj );
        this.buttonGroup1.add(this.existProj );
        newProj.setSelected(true);
        projectType=Wizard.New;*/

    //}

    public AskProjectTypePane(DataLoaders dataloader) {
        super(dataloader);
        initComponents();
        //this.add(this.getControlPane(), BorderLayout.SOUTH );
        this.buttonGroup1.add(this.newProj );
        this.buttonGroup1.add(this.currentProj );
        this.buttonGroup1.add(this.existProj );
        newProj.setSelected(true);
        projectType= WizardData.New;
    }

    public void setCurrentProjectEnable(boolean enable){
        this.currentProj.setEnabled(enable);
    }
     protected void setControlPane(JPanel p){
        p.add(leftBtn);
        //p.add(midBtn);
        p.add(rightBtn);

    }
   /* public void setAction(Action a){
         okBtn.setAction(a) ;
         okBtn.setText("OK");
    }*/

    public int getProjectType() {
        return projectType;
    }

    public void setProjectType(int projectType) {
        this.projectType = projectType;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        buttonGroup1 = new javax.swing.ButtonGroup();
        mainP = new javax.swing.JPanel();
        newProj = new javax.swing.JRadioButton();
        existProj = new javax.swing.JRadioButton();
        currentProj = new javax.swing.JRadioButton();
        controlP = this.getControlPane();//new javax.swing.JPanel();
        //okBtn = new javax.swing.JButton();
        //cancelBtn=new JButton();

        setLayout(new java.awt.BorderLayout());

        mainP.setLayout(new java.awt.GridLayout(3, 0));

        mainP.setBorder(new javax.swing.border.TitledBorder(null, "Welcome to the Data Wizard", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, DataLoaders.FONT_PAGE_TITLE,DataLoaders.COLOR_SECTION_TITLE ));//new java.awt.Color(0, 0, 255)
        newProj.setText("Create a new project");
        newProj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newProjActionPerformed(evt);
            }
        });

        mainP.add(newProj);

        existProj.setText("Load an existing project");
        existProj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                existProjActionPerformed(evt);
            }
        });

        mainP.add(existProj);

        currentProj.setText("Modify current project");
        currentProj.setEnabled(false);
        currentProj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                currentProjActionPerformed(evt);
            }
        });

        mainP.add(currentProj);

        add(mainP, java.awt.BorderLayout.CENTER);

        controlP.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

        /*okBtn.setText("OK");
        okBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                okBtnActionPerformed(evt);
            }
        });

        this.cancelBtn.setText("Cancel");
        this.controlP.add(cancelBtn);
        controlP.add(okBtn);*/

        add(controlP, java.awt.BorderLayout.SOUTH);

    }//GEN-END:initComponents

    private void existProjActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_existProjActionPerformed
        // TODO add your handling code here:
        this.setProjectType(WizardData.Exist);
    }//GEN-LAST:event_existProjActionPerformed

    private void newProjActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newProjActionPerformed
        // TODO add your handling code here:
        this.setProjectType(WizardData.New);
    }//GEN-LAST:event_newProjActionPerformed

    private void currentProjActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_currentProjActionPerformed
        // TODO add your handling code here:
        this.setProjectType(WizardData.Current);
    }//GEN-LAST:event_currentProjActionPerformed

    private void okBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okBtnActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_okBtnActionPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JPanel controlP;
    private javax.swing.JRadioButton currentProj;
    private javax.swing.JRadioButton existProj;
    private javax.swing.JPanel mainP;
    private javax.swing.JRadioButton newProj;
    //private javax.swing.JButton okBtn;
    //private JButton cancelBtn;
    // End of variables declaration//GEN-END:variables
    
}
